package top.yxf.spring.test.common;

import top.yxf.spring.beans.BeansException;
import top.yxf.spring.beans.PropertyValue;
import top.yxf.spring.beans.PropertyValues;
import top.yxf.spring.beans.factory.ConfigurableListableBeanFactory;
import top.yxf.spring.beans.factory.config.BeanDefinition;
import top.yxf.spring.beans.factory.config.BeanFactoryPostProcessor;

public class MyBeanFactoryPostProcessor implements BeanFactoryPostProcessor {

    @Override
    public void postProcessBeanFactory(ConfigurableListableBeanFactory configurableListableBeanFactory) throws BeansException {
        BeanDefinition beanDefinition = configurableListableBeanFactory.getBeanDefinition("userService");
        PropertyValues propertyValues = beanDefinition.getPropertyValues();
        propertyValues.addPropertyValue(new PropertyValue("company", "Microsoft"));
    }
}
